<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        //String  字符串对象
        var str = "好好学习";

        var str1 = new String("天天向上");

        //属性
        // str.length;

        //方法
        //获取指定某个位置的值
        console.log(str.charAt(0));

        //返回指定字符在字符串中第一次出现位置
        console.log(str1.indexOf("上"));

        //去除字符串两端的空格
        var str3 = "   abc    ";
        alert(1 + str3.trim() + 1);


    </script>
</head>

<body>

</body>

</html>